package net.loststone

class JobController {

    def infojobsSlurperService

    def index = {
        redirect(action: "list", params: params)
    }

    def list = {
        def town_id = params.town_id;
        def keyword = params.keywords;
        if (town_id && keyword) {
            def jobs = infojobsSlurperService.slurp(params);

            [jobInstanceList: jobs, jobInstanceTotal: jobs.size()]
        }
        else {
            [jobInstanceList: [], jobInstanceTotal: 0]
        }
    }

}
